// 创建一个为Count服务的reducer

import { INCREMENT, DECREMENT } from '../const'

const initState = 0
export default function countReducer(preState = initState, action) {
  let { type, data } = action

  switch (type) {
    case INCREMENT:
      return preState + 1

    case DECREMENT:
      return preState - 1

    default:
      return preState
  }
}
